package com.zd.kids.ui.adapter;

import android.widget.TextView;

import com.blankj.utilcode.util.TimeUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hyy.libray.common.BaseUtils;
import com.zd.kids.R;

import java.util.List;

import androidx.annotation.Nullable;

/**
 * @ClassName: com.zd.kids.ui.adapter
 * @Description:
 * @Author: hyy
 * @Date: 2020/6/18
 * @Time: 2:23 PM
 */
public class CalendarClassTimeAdapter extends BaseQuickAdapter<Long, BaseViewHolder> {
    public CalendarClassTimeAdapter(@Nullable List<Long> data) {
        super(R.layout.activity_calendar_class_item, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Long item) {
        TextView tv_time = helper.getView(R.id.tv_time);

        tv_time.setText(BaseUtils.getAmPmDateStr(item));

        long curTime = System.currentTimeMillis();

        if (item > curTime && (item - curTime) <= 1 * 60 * 60 * 1000) {
            tv_time.setTextColor(0xFF3fada9);
        } else {
            tv_time.setTextColor(0xFF656565);
        }

        TextView tv_positon = helper.getView(R.id.tv_positon);

        tv_positon.setText((helper.getAbsoluteAdapterPosition() + 1) + "");
    }
}
